package com.wanbangee.marksystem.controller;

import java.util.HashMap;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.wanbangee.marksystem.analysisservice.ObjectiveAndSubjectiveDistributionService;
import com.wanbangee.marksystem.analysisservice.QueryCurrentExamService;
import com.wanbangee.marksystem.service.QueryObjectiveAndSubjectiveSituationService;

@CrossOrigin
@RestController
@RequestMapping("/topicNoScoreInfo")
public class TestScoresSituationController {

	@Autowired
	private QueryObjectiveAndSubjectiveSituationService queryObjectiveAndSubjectiveSituationService;
	
	@Autowired
	private ObjectiveAndSubjectiveDistributionService objectiveAndSubjectiveDistributionService;
	
	@Autowired
	private QueryCurrentExamService queryCurrentExamService;
	
	
	@GetMapping("/selectTopicGeneralSituation")
	public Map<String, Object> selectTopicGeneralSituation(Integer examId,Integer claId,Integer subId){
		return this.queryObjectiveAndSubjectiveSituationService.selectObjectiveAndSubjectiveSituation(examId, subId, claId);
	}
	
	@GetMapping("/selectObjectiveInfo")
	public Map<String, Object> selectObjectiveInfo(Integer examId,Integer subId,Integer claId){
		Map<String, Object> map = new HashMap<>();
		map.put("objectiveInfo", this.queryObjectiveAndSubjectiveSituationService.selectObjectiveScoreSituation(examId, subId, claId));
		return map;
	}
	
	@GetMapping("/selectSubjectiveInfo")
	public Map<String, Object> selectSubjectiveInfo(Integer examId,Integer subId,Integer claId){
		Map<String, Object> map = new HashMap<>();
		map.put("subjectiveInfo", this.queryObjectiveAndSubjectiveSituationService.selectSubjectiveScoreSituation(examId, subId, claId));
		return map;
	}
	
	@GetMapping("/selectOptionDistribution")
	public Map<String, Object> selectOptionDistribution(Integer examId,Integer subId,Integer claId,String topicNo){
		return this.objectiveAndSubjectiveDistributionService.selectOptionDistribution(examId, subId, claId, topicNo);
	}
	
	@GetMapping("/selectStudentOption")
	public Map<String, Object> selectStudentOption(Integer examId, Integer subId, Integer claId, String topicNo,
			String option, String stuNmAndStuNo, Integer pageNum, Integer pageSize){
		return this.objectiveAndSubjectiveDistributionService.selectStudentOption(examId, subId, claId, topicNo, option, stuNmAndStuNo, pageNum, pageSize);
	}
	
	@GetMapping("/selectExcellenceAndErrAnswerSheet")
	public Map<String, Object> selectExcellenceAndErrAnswerSheet(Integer examId,Integer subId,Integer claId,String topicNo,Integer recordType){
		return this.queryCurrentExamService.selectExcellenceAndErrAnswerSheet(examId, subId, claId, topicNo, recordType);
	}
	
	@GetMapping("/selectStuSubjective")
	public Map<String, Object> selectStuSubjective(Integer examId,Integer subId,String topicNo,Integer claId,
			Double minScore,Double maxScore,String stuNmOrStuNo,Integer pageNum,Integer pageSize){
		return this.objectiveAndSubjectiveDistributionService.selectStuSubjective(examId, subId, topicNo, claId, minScore, maxScore, stuNmOrStuNo, pageNum, pageSize);
	}
	
	@GetMapping("/selectSubjectiveDistribution")
	public Map<String, Object> selectSubjectiveDistribution(Integer examId,Integer subId,String topicNo,Integer claId){
		return this.objectiveAndSubjectiveDistributionService.selectSubjectiveDistribution(examId, subId, claId, topicNo);
	}
}
